import os
import sys
from pathlib import Path
from typing import List

from fastapi_amis_admin import admin

BACKEND_DIR = Path(__file__).resolve().parent.parent
sys.path.append(BACKEND_DIR.__str__())
# 静态资源路径（图片等存放位置）
STATIC_DIR = BACKEND_DIR / "static"
IMAGE_DIR = STATIC_DIR / "images"
# 自动创建目录（避免启动时目录不存在报错）
STATIC_DIR.mkdir(exist_ok=True)

class Settings(admin.Settings):
    name: str = "FastAPI-User-Auth-Demo"
    secret_key: str = ""
    allow_origins: List[str] = []
    STATIC_URL: str = "/static"
    STATIC_DIR: str = STATIC_DIR.__str__()
    SITE_TITLE: str = "铁塔基站管理系统"
    SITE_ICON: str = "/static/images/logo.png"
    TEMPLATE_PATH: Path = BACKEND_DIR / "templates"
# 设置FAA_GLOBALS环境变量
os.environ.setdefault("FAA_GLOBALS", "core.globals")

settings = Settings(_env_file=os.path.join(BACKEND_DIR, ".env"))
